#include <iostream>
#include <string>
#include <vector>
class StrHelper
{
public:
    static ssize_t splite(const std::string &str, const std::string &seq, std::vector<std::string> &result)
    {
        // music..pop..#
        ssize_t pos = 0, index = 0;
        while (index < str.size())
        {
            pos = str.find(seq, index);
            if (pos == std::string::npos)
            {
                // 不存在就截取到末尾
                result.push_back(str.substr(index));
                return result.size();
            }

            if (index == pos)
            {
                // 跳过当前的点
                index += seq.size();
                continue;
            }

            result.push_back(str.substr(index, pos - index));
            index = pos + seq.size();
        }
        return result.size();
    }
};

int main()
{
    std::string str = "...music..pop.#...";
    std::vector<std::string> ret;
    std::string seq = ".";
    StrHelper::splite(str, seq, ret);
    for (auto &s : ret)
    {
        std::cout << s << std::endl;
    }
    return 0;
}